package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.his.service.IHisBigdataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.HisEngineWarnTypeMapper;
import com.ruoyi.system.domain.HisEngineWarnType;
import com.ruoyi.system.service.IHisEngineWarnTypeService;

/**
 * 预警类型Service业务层处理
 *
 * @author Alan
 * @date 2024-03-07
 */
@Service
public class HisEngineWarnTypeServiceImpl implements IHisEngineWarnTypeService
{
    @Autowired
    private HisEngineWarnTypeMapper hisEngineWarnTypeMapper;

    @Autowired
    private IHisBigdataService hisBigdataService;

    /**
     * 查询预警类型
     *
     * @param id 预警类型主键
     * @return 预警类型
     */
    @Override
    public HisEngineWarnType selectHisEngineWarnTypeById(Integer id)
    {
        return hisEngineWarnTypeMapper.selectHisEngineWarnTypeById(id);
    }

    /**
     * 查询预警类型列表
     *
     * @param hisEngineWarnType 预警类型
     * @return 预警类型
     */
    @Override
    public List<HisEngineWarnType> selectHisEngineWarnTypeList(HisEngineWarnType hisEngineWarnType)
    {
        return hisEngineWarnTypeMapper.selectHisEngineWarnTypeList(hisEngineWarnType);
    }

    /**
     * 新增预警类型
     *
     * @param hisEngineWarnType 预警类型
     * @return 结果
     */
    @Override
    public int insertHisEngineWarnType(HisEngineWarnType hisEngineWarnType)
    {
        hisEngineWarnType.setCreateTime(DateUtils.getNowDate());

        int result = hisEngineWarnTypeMapper.insertHisEngineWarnType(hisEngineWarnType);
        /**
         * 通知大数据
         */
        hisBigdataService.updateWarnConfig();
        return result;
    }

    /**
     * 修改预警类型
     *
     * @param hisEngineWarnType 预警类型
     * @return 结果
     */
    @Override
    public int updateHisEngineWarnType(HisEngineWarnType hisEngineWarnType)
    {
        int result = hisEngineWarnTypeMapper.updateHisEngineWarnType(hisEngineWarnType);
        /**
         * 通知大数据
         */
        hisBigdataService.updateWarnConfig();
        return result;
    }

    /**
     * 批量删除预警类型
     *
     * @param ids 需要删除的预警类型主键
     * @return 结果
     */
    @Override
    public int deleteHisEngineWarnTypeByIds(Integer[] ids)
    {
        int result = hisEngineWarnTypeMapper.deleteHisEngineWarnTypeByIds(ids);
        /**
         * 通知大数据
         */
        hisBigdataService.updateWarnConfig();
        return result;
    }

    /**
     * 删除预警类型信息
     *
     * @param id 预警类型主键
     * @return 结果
     */
    @Override
    public int deleteHisEngineWarnTypeById(Integer id)
    {
        int result = hisEngineWarnTypeMapper.deleteHisEngineWarnTypeById(id);
        /**
         * 通知大数据
         */
        hisBigdataService.updateWarnConfig();
        return result;
    }
}
